/*
 * Copyright [2022] [https://www.xiaonuo.vip]
 *
 * Snowy采用APACHE LICENSE 2.0开源协议，您在使用过程中，需要注意以下几点：
 *
 * 1.请不要删除和修改根目录下的LICENSE文件。
 * 2.请不要删除和修改Snowy源码头部的版权声明。
 * 3.本项目代码可免费商业使用，商业使用请保留源码和相关描述文件的项目出处，作者声明等。
 * 4.分发源码时候，请注明软件出处 https://www.xiaonuo.vip
 * 5.不可二次分发开源参与同类竞品，如有想法可联系团队xiaonuobase@qq.com商议合作。
 * 6.若您的项目无法满足以上几点，需要更多功能代码，获取Snowy商业授权许可，请在官网购买授权，地址为 https://www.xiaonuo.vip
 */
package vip.xiaonuo.biz.modular.jxrw.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.mybatisflex.core.paginate.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.noear.solon.annotation.*;
import org.noear.solon.core.handle.Context;
import org.noear.solon.validation.annotation.NotEmpty;
import org.noear.solon.validation.annotation.Valid;
import vip.xiaonuo.common.annotation.CommonLog;
import vip.xiaonuo.common.pojo.CommonResult;
import vip.xiaonuo.common.pojo.CommonValidList;
import vip.xiaonuo.biz.modular.jxrw.entity.JwJxrw;
import vip.xiaonuo.biz.modular.jxrw.param.JwJxrwAddParam;
import vip.xiaonuo.biz.modular.jxrw.param.JwJxrwEditParam;
import vip.xiaonuo.biz.modular.jxrw.param.JwJxrwIdParam;
import vip.xiaonuo.biz.modular.jxrw.param.JwJxrwPageParam;
import vip.xiaonuo.biz.modular.jxrw.service.JwJxrwService;
import vip.xiaonuo.sys.modular.user.param.SysUserIdParam;

import java.io.IOException;

/**
 * 教学任务控制器
 *
 * @author lrw
 * @date  2025/02/09 11:00
 */
@Api(tags = "教学任务控制器")
@Controller
@Valid
public class JwJxrwController {

    @Inject
    private JwJxrwService jwJxrwService;

    /**
     * 获取教学任务分页
     *
     * @author lrw
     * @date  2025/02/09 11:00
     */
    @ApiOperation("获取教学任务分页")
    @SaCheckPermission("/biz/jxrw/page")
    @Get
    @Mapping("/biz/jxrw/page")
    public CommonResult<Page<JwJxrw>> page(JwJxrwPageParam jwJxrwPageParam) {
        return CommonResult.data(jwJxrwService.page(jwJxrwPageParam));
    }
    @CommonLog("导出课表信息")
    @Get
    @Mapping(value = "/biz/jxrw/exportJxrwInfo")
    public void exportJxrwInfo(JwJxrwPageParam jwJxrwPageParam, Context response) throws IOException {
        jwJxrwService.exportJxrw(jwJxrwPageParam, response);
    }
    @CommonLog("导出教师课表")
    @Get
    @Mapping(value = "/biz/jxrw/exportJxrw4Tea")
    public void exportJxrw4Tea(JwJxrwPageParam jwJxrwPageParam, Context response) throws IOException {
        jwJxrwService.exportJxrw4Tea(jwJxrwPageParam, response);
    }
    @CommonLog("导出教室课表")
    @Get
    @Mapping(value = "/biz/jxrw/exportJxrw4Room")
    public void exportJxrw4Room(JwJxrwPageParam jwJxrwPageParam, Context response) throws IOException {
        jwJxrwService.exportJxrw4Room(jwJxrwPageParam, response);
    }
    @CommonLog("导出课程清单信息")
    @Get
    @Mapping(value = "/biz/jxrw/exportJxrwListInfo")
    public void exportJxrwListInfo(JwJxrwPageParam jwJxrwPageParam, Context response) throws IOException {
        jwJxrwService.exportJxrwList(jwJxrwPageParam, response);
    }
    /**
     * 添加教学任务
     *
     * @author lrw
     * @date  2025/02/09 11:00
     */
    @ApiOperation("添加教学任务")
    @CommonLog("添加教学任务")
    @SaCheckPermission("/biz/jxrw/add")
    @Post
    @Mapping("/biz/jxrw/add")
    public CommonResult<String> add(JwJxrwAddParam jwJxrwAddParam) {
        jwJxrwService.add(jwJxrwAddParam);
        return CommonResult.ok();
    }

    /**
     * 编辑教学任务
     *
     * @author lrw
     * @date  2025/02/09 11:00
     */
    @ApiOperation("编辑教学任务")
    @CommonLog("编辑教学任务")
    @SaCheckPermission("/biz/jxrw/edit")
    @Post
    @Mapping("/biz/jxrw/edit")
    public CommonResult<String> edit(JwJxrwEditParam jwJxrwEditParam) {
        jwJxrwService.edit(jwJxrwEditParam);
        return CommonResult.ok();
    }

    /**
     * 删除教学任务
     *
     * @author lrw
     * @date  2025/02/09 11:00
     */
    @ApiOperation("删除教学任务")
    @CommonLog("删除教学任务")
    @SaCheckPermission("/biz/jxrw/delete")
    @Post
    @Mapping("/biz/jxrw/delete")
    public CommonResult<String> delete(@NotEmpty(message = "集合不能为空")
                                                   CommonValidList<JwJxrwIdParam> jwJxrwIdParamList) {
        jwJxrwService.delete(jwJxrwIdParamList);
        return CommonResult.ok();
    }

    /**
     * 获取教学任务详情
     *
     * @author lrw
     * @date  2025/02/09 11:00
     */
    @ApiOperation("获取教学任务详情")
    @SaCheckPermission("/biz/jxrw/detail")
    @Get
    @Mapping("/biz/jxrw/detail")
    public CommonResult<JwJxrw> detail(JwJxrwIdParam jwJxrwIdParam) {
        return CommonResult.data(jwJxrwService.detail(jwJxrwIdParam));
    }
}
